<template>
  <div>
    <div class="header"></div>
    <div class="box">
      <div class="box-txt" v-for="(item, index) in arr" :key="index">
        <div>{{ item }}</div>
        <div>{{ info[index] }}</div>
      </div>
    </div>
    <div class="box">
      <div class="box-txt" v-for="(item, index) in arr1" :key="index">
        <div>{{ item }}</div>
        <div>
          <input type="text" />
        </div>
      </div>
    </div>

    <div class="footer">
      <div @click="btn">确定提交发货消息</div>
    </div>
  </div>
</template>

<script>
import { info, send } from "../../request/api";
export default {
    
  data() {
    return {
      arr: ["客户", "商品", "数量", "下单人", "下单时间"],
      arr1: ["收货人", "联系电话", "收货地址", "物流单号"],
      info: [],
    };
  },
  created() { 
    let serialNo = this.$route.params.id;
    info(serialNo).then((res) => {
      if (res.errCode == 0) {
        let data = res.data;
        console.log(data);
        this.info.push(data.cusName);
        this.info.push(data.prodName);
        this.info.push(data.prodNum);
        this.info.push(data.orderUserName);
        this.info.push(data.orderTime);
        console.log(data);
      }
    });
  },
  methods:{   
        btn(){
            let arr = document.querySelectorAll('input');
             let serialNo = this.$route.params.id;
            send({
                serialNo,
                receiver:arr[0].value,
                linkPhone:arr[1].value,
                address:arr[2].value,
                logisticsCode:arr[3].value
            }).then(res=>{
                if(res.errCode==0){
                   this.$toast.success('发货成功');
                   this.$router.push('/home/funindex/dispatchList')
                }
            })
        }
    },
};
</script>
 
<style lang = "less" scoped>
*{
    padding: 0;margin: 0;
}
.header {
  width: 100vw;
  height: 64px;
  background: #003399;
}
.box {
  margin-top: 10px;
  background: #fff;
}
.box-txt {
  border-bottom: 1px solid #979797;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  input {
    border: none;
    background: #666;
    outline: none;
  }
}
.footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 60px;
  background: #fff;
  div {
    text-align: center;
    line-height: 44px;
    color: #fff;
    font-weight: bold;
    font-size: 18px;
    margin: 8px 0 0 10px;
    border-radius: 22px;
    width: 355px;
    height: 44px;
    background: #1e3695;
  }
}
</style>